//
//  DrawEcg.h
//  Ikinloop-demo
//
//  Created by Li Shen on 2021/4/22.
//  Copyright © 2021 lyh. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface DrawLiveEcgMgr : NSObject

- (instancetype)initWithLayer:(CALayer*)layer;

- (instancetype)initWithLayer:(CALayer*)layer context:(CGContextRef)context;

@property (nonatomic, assign) CGContextRef context;

//采样率
@property (nonatomic, assign) CGFloat sampleRate;
//走纸速度
@property (nonatomic, assign) CGFloat ecgSpeed;
//增益
@property (nonatomic, assign) CGFloat ecgGain;
//背景颜色
@property (nonatomic, assign) UIColor *bgColor;
//背景大格子颜色
@property (nonatomic, strong) UIColor *gridColor;
//背景小格子颜色
@property (nonatomic, strong) UIColor *smallgridColor;
//心电图波形颜色
@property (nonatomic, strong) UIColor *ecgColor;
//心电图波形宽度
@property (nonatomic, assign) CGFloat ecgLineWidth;
//大格子宽度
@property (nonatomic, assign) CGFloat gridLineWidth;
//小格子宽度
@property (nonatomic, assign) CGFloat smallGridLineWidth;


- (void)reset;
- (void)reload;
//画背景格子
- (void)drawBackgroundGrid;

- (void)drawLineEcg:(NSArray*)ecgdatas ecgStates:(NSArray *)ecgstates;
- (void)drawWaveByRepeat:(int)ecgdata;

- (CGFloat)getxStepPixelPerPoint;
- (int)getPointMaxNumPerScreen;
- (void)getEcgStateByXY:(CGPoint)point;
@end

NS_ASSUME_NONNULL_END
